// pages/spot/make.js
var dateTimePicker = require('../../utils/dateTimePicker.js');
Page({

    /**
     * 页面的初始数据
     */
    data: {
        active: '',
        status: '',
        date: '选择入住时间',
        gender: ['优惠券一', '优惠券二'],
        select: '请选择商城优惠券',
        startYear: 2000,
        endYear: 2050,
        type: [
            '条件退',
            '条件退',
            '4星级酒店'
        ],
        selectIs: false,
        selectSrc: '../../image/selection-icon1.png'
    },

    select(e) {
        if (e.target.dataset.type == false) {
            this.setData({ selectIs: true });
            this.setData({ selectSrc: '../../image/selection-icon2.png' });
        } else {
            this.setData({ selectIs: false });
            this.setData({ selectSrc: '../../image/selection-icon1.png' });
        }
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var obj = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
        var obj1 = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
        // 精确到分的处理，将数组的秒去掉
        var lastArray = obj1.dateTimeArray.pop();
        var lastTime = obj1.dateTime.pop();

        this.setData({
            dateTime: obj.dateTime,
            dateTimeArray: obj.dateTimeArray,
            dateTimeArray1: obj1.dateTimeArray,
            dateTime1: obj1.dateTime
        });
    },

    changeDate(e) {
        this.setData({ date: e.detail.value });
    },

    bindViewEvent: function (e) {
        console.log(e)
        this.setData({ select: e.detail.value });
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})